
#ifndef __DEFORMATION_SHAPE_FSGPU_H_
#define __DEFORMATION_SHAPE_FSGPU_H_

#include "glslkernel.h"
#include "./mlsdeformer/typedefs.h"
#include "./mlsdeformer/constraints.h"
#include "./mlsdeformer/deformation.h"
#include "./mlsdeformer/shape3D.h"
#include "./mlsdeformer/weightsScheme.h"

#include <fstream>

namespace MLS {

/// This class implements the MLS deformation process
/// using the GPU capabilities of the fragment shader processor
class DeformationShape_FSGPU : public Deformation {
   
public:
   DeformationShape_FSGPU();
   ~DeformationShape_FSGPU();
   
   void setting(Shape3D *model, const MLS::Constraints *constraints);
   
   /// Executes the MLS-deformation induced by the deformed constraints positions
   ///@param constraints the deformed constraints 
   void execute_deformation(const MLS::Constraints *constraints);

protected:
   void setFBO();
   
protected:
   Shape3D                  *model;                //< the model positions
   
   GLSLKernel                kernel;               //< the mls as-rigid-as-possible kernel
   GLuint                    texPpoints;           //< texture object for P points
   GLuint                    texQpoints;           //< texture object for Q points
   GLuint                    texModelPositions;    //< texture object for model positions
   
   GLuint                    quadSize;             //< quad size: It is used to generate the fragments
   GLuint                    texFBO[2];            //< FBO's texture objects 
   GLuint                    fbo;                  //< The framebuffer object
   
   std::string               shaderFileName;       //< the name of the soource file
};

} // end MLS namespace

#endif
